﻿using PmpNetwork.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PmpNetwork.ViewModels
{
    public class QuestionViewModel
    {
        public int? Id {get; set;}
        public int? ArticleId { get; set; }
        public string Text { get; set; }
        public int? DisplayIndex { get; set; }
        public string Reason { get; set; }
        public IList<QuestionOptionViewModel> Options { get; set; }

        public void Fill(WikiQuestionPart part)
        {
            if (part == null) return;

            if (this.Text != null && !this.Text.Equals(part.Text))
            {
                part.Text = this.Text;
            }

            if (this.DisplayIndex != null && !this.DisplayIndex.Equals(part.DisplayIndex))
            {
                part.DisplayIndex = this.DisplayIndex.Value;
            }

            if (this.Reason != null && !this.Reason.Equals(part.Reason))
            {
                part.Reason = this.Reason;
            }
        }
    }
}